package com.asset.dispoal.file.agreementCaseData.service;

import com.asset.dispoal.file.agreementCaseData.api.AgreementCaseDataService;
import com.asset.dispoal.file.agreementCaseData.dto.AddressGetCodeRequest;
import com.asset.dispoal.file.agreementCaseData.dto.AgreementExportRequest;
import com.asset.dispoal.file.agreementCaseData.dto.ExportEvidenceDataRequest;
import com.asset.dispoal.file.agreementCaseData.dto.ImportAbolishCaseRequest;
import com.asset.dispoal.file.agreementCaseData.dto.ImportRevertCaseRequest;
import com.asset.dispoal.file.agreementCaseData.dto.ImportSmsStateRequest;
import com.asset.dispoal.file.agreementCaseData.dto.RefreshIdCardRequest;
import com.asset.dispoal.file.agreementCaseData.service.commom.CaseAddressGetCodeCommand;
import com.asset.dispoal.file.agreementCaseData.service.commom.ExportCaseExcelCommand;
import com.asset.dispoal.file.agreementCaseData.service.commom.ExportEvidenceDataCommand;
import com.asset.dispoal.file.agreementCaseData.service.commom.ExportExcelCommand;
import com.asset.dispoal.file.agreementCaseData.service.commom.ExportExcelTemplateCommand;
import com.asset.dispoal.file.agreementCaseData.service.commom.ExportNoRefreshIdCardCommand;
import com.asset.dispoal.file.agreementCaseData.service.commom.ImportAbolishCaseCommand;
import com.asset.dispoal.file.agreementCaseData.service.commom.ImportExcelCommand;
import com.asset.dispoal.file.agreementCaseData.service.commom.ImportNoIdCardRefreshCommand;
import com.asset.dispoal.file.agreementCaseData.service.commom.ImportRevertCaseCommand;
import com.asset.dispoal.file.agreementCaseData.service.commom.ImportSmsStateCommand;
import com.asset.dispoal.file.agreementCaseData.service.commom.RefreshIdCardCommand;
import com.asset.dispoal.file.agreementCaseData.service.commom.UploadExcelCommand;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import tech.mhuang.pacebox.springboot.protocol.Result;

import javax.servlet.http.HttpServletResponse;
import java.util.HashMap;
import java.util.Map;


/**
 * @author qr
 * @date 2022/4/6$
 */
@Service
public class AgreementCaseDataServiceImpl implements AgreementCaseDataService {

    @Autowired
    ImportExcelCommand importExcelCommand;

    @Autowired
    ImportAbolishCaseCommand importAbolishCaseCommand;

    @Autowired
    UploadExcelCommand uploadExcelCommand;

    @Autowired
    ExportExcelCommand exportExcelCommand;

    @Autowired
    ExportCaseExcelCommand exportCaseExcelCommand;

    @Autowired
    ExportExcelTemplateCommand exportExcelTemplateCommand;

    @Autowired
    ExportEvidenceDataCommand exportEvidenceDataCommand;

    @Autowired
    RefreshIdCardCommand refreshIdCardCommand;

    @Autowired
    ImportSmsStateCommand importSmsStateCommand;

    @Autowired
    ExportNoRefreshIdCardCommand exportNoRefreshIdCardCommand;

    @Autowired
    ImportNoIdCardRefreshCommand importNoIdCardRefreshCommand;

    @Autowired
    ImportRevertCaseCommand importRevertCaseCommand;

    @Autowired
    CaseAddressGetCodeCommand caseAddressGetCodeCommand;

    @Override
    public Result<String> importData(MultipartFile multipartFile) {
        return importExcelCommand.execute(multipartFile);
    }

    @Override
    public Result uploadExcel(String filePath, String assetInstBatchId) {
        Map<String, String> map = new HashMap<>(2);
        map.put("filePath", filePath);
        map.put("assetInstBatchId", assetInstBatchId);
        return uploadExcelCommand.execute(map);
    }

    @Override
    public void exportExcelTemplate(HttpServletResponse response, String assetInstBatchId) {
        Map<String, Object> map = new HashMap<>(2);
        map.put("response", response);
        map.put("assetInstBatchId", assetInstBatchId);
        exportExcelTemplateCommand.execute(map);
    }

    @Override
    public void exportExcel(HttpServletResponse response, AgreementExportRequest request) {
        Map<String, Object> map = new HashMap<>(2);
        map.put("response", response);
        map.put("agreementRequest", request);
        exportExcelCommand.execute(map);
    }

    @Override
    public void exportCaseExcel(HttpServletResponse response, AgreementExportRequest request) {
        Map<String, Object> map = new HashMap<>(2);
        map.put("response", response);
        map.put("agreementRequest", request);
        exportCaseExcelCommand.execute(map);
    }

    @Override
    public void exportEvidenceData(HttpServletResponse response, ExportEvidenceDataRequest request) {
        Map<String, Object> map = new HashMap<>(2);
        map.put("response", response);
        map.put("request", request);
        exportEvidenceDataCommand.execute(map);
    }

    @Override
    public Result importAbolishCase(ImportAbolishCaseRequest request) {
        return importAbolishCaseCommand.execute(request);
    }

    @Override
    public Result refreshIdCard(RefreshIdCardRequest request) {
        return refreshIdCardCommand.execute(request);
    }

    @Override
    public Result importSmsState(ImportSmsStateRequest request) {
        return importSmsStateCommand.execute(request);
    }

    @Override
    public Result exportNoIdCardRefreshData(String id) {
        return exportNoRefreshIdCardCommand.execute(id);
    }

    @Override
    public Result importIdCardDate(MultipartFile file) {
        return importNoIdCardRefreshCommand.execute(file);
    }

    @Override
    public Result importRevertCase(ImportRevertCaseRequest request) {
        return importRevertCaseCommand.execute(request);
    }

    @Override
    public Result caseAddressGetCode(AddressGetCodeRequest request) {
        return caseAddressGetCodeCommand.execute(request);
    }
}
